package com.uuah.server.message.busi;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 *
 * TODO comment ...
 *
 * <p>
 * update record:updator，update time，update content and version
 * </p>
 *
 * @author <a href="jonny_quan@hotmail.com">jonny</a>
 * @date 2009 2009-3-27 下午01:55:00
 * @version 1.0.0
 */
public class BaseBusiMessage implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = -2410065559311769899L;

	private int basicVer = 1;// basic version
	private int length;
	private String transactionId; // transaction Id
	private int type;
	private String reserved;
	private int code;
	private int dataLength;

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public int getDataLength() {
		return dataLength;
	}

	public void setDataLength(int dataLength) {
		this.dataLength = dataLength;
	}

	public int getBasicVer() {
		return basicVer;
	}

	public void setBasicVer(int basicVer) {
		this.basicVer = basicVer;
	}

	public String getTransactionId() {
		if (StringUtils.isBlank(transactionId)) {
			transactionId = "0000000000000000";
		}
		return transactionId;
	}

	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getReserved() {
		if (StringUtils.isBlank(reserved)) {
			reserved = "000";
		}
		return reserved;
	}

	public void setReserved(String reserved) {
		this.reserved = reserved;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}
}
